<?php

class M_homepage extends CI_Model {

    public function __construct() {
        parent::__construct();
        $this->load->database();
    }

    public function categoties() {
        $query = "SELECT cat_id, cat_name FROM categories";
        $result = $this->db->query($query);
        return $result->result_array();
    }

    public function pages() {
        $query = "SELECT * FROM pages";
        $result = $this->db->query($query);
        return $result->result_array();
    }

    public function content1($cat_id) {
        $query = "SELECT * FROM pages WHERE cat_id = {$cat_id}";
        $result = $this->db->query($query);
        return $result->result_array();
    }

    public function content2($page_id) {
        $query = "SELECT * FROM pages WHERE page_id = {$page_id}";
        $result = $this->db->query($query);
        return $result->result_array();
    }
}

?>
